package data;

/**
 *
 * @author David Csejtei, CodeGuide Team, http://codeguide.hu
 */

public class Event extends Thread {

    private float oneChance;
    private float twoChance;
    private float xChance;
    private int startTime;
    private int endTime;
    
    public int ido = 0;
    public boolean isBettable = false;
    
    public void setEventName(final String name) {
        setName(name);
    }
    
    @Override
    public void run() {
        
        try {
            
            while (true) {
              
                if(ido==startTime) {
                    isBettable = true;
                }
                
                if(isBettable) {
                    System.out.println(ido+" | Lehet fogadni rá: "+getName());
                }
                
                if(ido==endTime) {
                    isBettable = false;
                    break;
                }
  
                Thread.sleep(1*1000);
                ido+=1000;
            }
            
        } catch (InterruptedException e) {
            System.out.println("Exception: "+e.getMessage());
        }
    }

    public float getOneChance() {
        return oneChance;
    }

    public void setOneChance(float oneChance) {
        this.oneChance = oneChance;
    }

    public float getTwoChance() {
        return twoChance;
    }

    public void setTwoChance(float twoChance) {
        this.twoChance = twoChance;
    }

    public float getxChance() {
        return xChance;
    }

    public void setxChance(float xChance) {
        this.xChance = xChance;
    }

    public int getStartTime() {
        return startTime;
    }

    public void setStartTime(int startTime) {
        this.startTime = startTime;
    }

    public int getEndTime() {
        return endTime;
    }

    public void setEndTime(int endTime) {
        this.endTime = endTime;
    }
    
    @Override
    public String toString() {
        return "Event{" + 
                "name=" + getName() + ", " +
                "1(%)=" + oneChance + ", " +
                "2(%)=" + twoChance + ", " +
                "x(%)=" + xChance + ", " +
                "startTime=" + startTime + ", " +
                "endTime=" + endTime + "}";
    }
 
}
